public class test56 {
    public static void main(String[] args) {
        //将A->B
        String strA = "abcde";
        String strB = "bcdea";
        boolean flag = flag(strA, strB);
        System.out.println(flag);
    }

    public static boolean flag(String strA, String strB) {
        strA = rotate(strA);
        for (int i = 0; i < strA.length(); i++) {
            if (strA.equals(strB)) {
                return true;
            }
        }
        return false;
    }
      public static String rotate(String str) {
        char[] arr = str.toCharArray();
        char first =arr[0];
        for (int i = 1; i < arr.length; i++) {
            arr[i-1] = arr[i];
        }
        arr[arr.length-1] = first;
        String result = new String(arr);
        return result;
      }
   // public static String rotate(String str) {
     //    String str1 = str.substring(0,1);
       //  String str2 = str.substring(1);
         //return str2+str1;
    //}
}
